package com.ftg.learn.chapter08.pattern.factory.computertest;

/**
 * 计算工厂
 *
 * @author lijiaxin
 * @version 1.0
 * @date 2023/8/3 13:20
 */

public class ComputerFactory {

    public static Computer instanceC(String s){
        if(s==null){
            return null;
        }else if(s=="+"){
            return new Add();
        }else if(s=="-"){
            return new Reduce();
        }else if(s=="*"){
            return new Multiplication();
        }else if(s=="/"){
            return new Division();
        }
        return null;
    }
}
